#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;


class Solution {
public:
    vector<int> getAverages(vector<int>& nums, int k)
    {
        long long sum = 0;
        int max = nums.size();
        vector<int> ret(max, -1);
        for (int i = 0; i < max; i++)
        {
            sum += nums[i];
            if (i < (2 * k))
                continue;
            ret[i - k] = sum / (2 * k + 1);
            sum -= nums[i - 2 * k];
        }
        return ret;

    }
};